// auth project main.go
package main

import (
	"auth/handle"
	"fmt"
	"log"
	"net/http"
	"os"
)

func sayHello(w http.ResponseWriter, r *http.Request) {
	r.ParseForm()
	fmt.Fprintln(w, "hello visitor!")
}

func main() {
	defer func() {
		if err := recover(); err != nil {
			fmt.Println(err)
		}
	}()
	log.SetOutput(os.Stdout)

	http.HandleFunc("/", sayHello)
	http.HandleFunc("/login", handle.LoginHandle)
	http.HandleFunc("/regist", handle.RegistHandle)
	err := http.ListenAndServe(":8000", nil)
	if err != nil {
		log.Fatal("ListenAndServe: ", err)
	}
}
